Adding Quotation Marks with ::before in CSS
You can use the ::before pseudo-element to insert quotation marks or other decorative symbols before a paragraph. This allows you to add visual cues without changing the HTML content.
Use ::before with the content property to insert the quotation mark, e.g., content: '“';.
Set position: relative on the parent if you need precise control over placement.
Style the pseudo-element with font-size, color, margin, or transform to match your design.
Combine with ::after for closing quotation marks if needed.
In this example, the ::before pseudo-element inserts a gray quotation mark before the paragraph. You can adjust font-size, color, and position to match your layout and style preferences.
Use pseudo-elements for purely decorative symbols to avoid altering semantic HTML.
Ensure the quotation mark does not overlap text by adjusting padding or positioning.
Combine with ::after for closing quotes if needed for visual consistency.
Test across different screen sizes and browsers for proper alignment and display.
How would you add an opening quotation mark before every paragraph using only CSS, without touching the HTML?
What happens if you forget to set display: block on the paragraph when using ::before to add a quote?
A designer says the blockquote quotes look broken on mobile — the ::before quote is overlapping the text. How do you debug and fix this?
We’re using ::before to add quotes in a CMS-generated blog, but sometimes the quote appears even when there’s no paragraph content. How do you prevent that?
We’re building a multilingual content system where quote styles vary by locale — how would you architect the CSS to support this without bloating the stylesheet?
A performance audit shows our ::before quote styles are causing layout thrashing on low-end devices. What’s the root cause and how do you optimize it?
Our legacy design system uses ::before for quotes across 20+ products — we’re migrating to a design token system. How do you plan the deprecation and ensure no visual regressions?
We need to support screen readers properly while keeping visual quotes via CSS. How do you balance accessibility, maintainability, and design consistency at scale?